<?php
/*
 * @Author: LiuHaiL 18655112670@139.com
 * @Date: 2022-01-05 08:49:54
 * @LastEditors: LiuHaiL 18655112670@139.com
 * @LastEditTime: 2023-01-30 10:54:18
 * @FilePath: \ant_form_admind:\laragon\www\oa\app\admin\model\Vacation.php
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */


namespace app\admin\model;


use think\Model;
use think\model\concern\SoftDelete;

class Vacation extends Model
{
    use SoftDelete;
    protected $name = 'vacations';


    public static function checkDetail($id)
    {
        $res = self::find($id);
        $date_time = explode('~', $res->corresponding);
        $res['dy_start_time'] = reset($date_time);
        $res['dy_end_time'] = end($date_time);
        return $res;
    }

//    public function checkTaskStatus($id)
//    {
//        $sim = FlowTask::where(['from_table' => 'vacations', 'from_id' => $id])->select();
//        $status_count = 0;
//        foreach ($sim as $key => $value) {
//            if ($value['status'] == 2) {
//                $status_count++;
//            }
//        }
//        return $status_count;
//    }
}